package cn.com.pajx.pajx_visitor_v3.ui.activity;

import android.annotation.SuppressLint;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.OnClick;
import cn.com.pajx.pajx_visitor_v3.R;
import cn.com.pajx.pajx_visitor_v3.base.BaseActivity;
import cn.com.pajx.pajx_visitor_v3.utils.AppConstant;

/**
 * 新建拜访页面
 */
@SuppressLint("NonConstantResourceId")
public class CommonSuccessActivity extends BaseActivity {

    @BindView(R.id.view_common_success)
    LinearLayout viewCommonSuccess;
    @BindView(R.id.view_start_success)
    LinearLayout viewStartSuccess;
    @BindView(R.id.view_new_success)
    RelativeLayout viewNewSuccess;
    @BindView(R.id.tv_common_des)
    TextView tvCommonDes;

    private String success_type = "1", title;


    @Override
    protected void beforeSetContentView() {
        success_type = getIntent().getStringExtra(AppConstant.TYPE);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_common_success;
    }

    @Override
    protected void initView() {
        initTypeView();
        loadMillsFuture(15000);
        initDownTimer();

    }

    private void initTypeView() {
        switch (success_type) {
            case "0"://新建拜访成功
                setHeadTitle("新建拜访成功");
                tvCommonDes.setText("新建拜访成功!");
                viewCommonSuccess.setVisibility(View.VISIBLE);
                viewStartSuccess.setVisibility(View.GONE);
                viewNewSuccess.setVisibility(View.VISIBLE);
                break;
            case "1"://开始拜访成功
                setHeadTitle("开始拜访成功");
                viewCommonSuccess.setVisibility(View.GONE);
                viewStartSuccess.setVisibility(View.VISIBLE);
                break;
            case "2"://结束拜访成功
                setHeadTitle("结束拜访成功");
                tvCommonDes.setText("结束拜访成功!");
                viewCommonSuccess.setVisibility(View.VISIBLE);
                viewStartSuccess.setVisibility(View.GONE);
                break;
        }
    }


    @OnClick({R.id.tv_back, R.id.tv_start_back})
    public void onClickViewed(View view) {
        finish();
    }
}